import { Request as request } from '@/utils/request'
import { store } from '@/store/store'

export const getTokenByCode = (data: any) => {
  return request({
    url: '/auth/accessToken',
    method: 'get',
    params: data
  })
}

/**
 * 获取当前登录用户基本信息
 */
export const getUserInfo = () => {
  return request({
    url: '/user/info',
    method: 'get'
  })
}

// @ts-ignore
export const refreshToken = (token: string) => {
  return request({
    url: '/auth/refreshToken',
    method: 'post',
    params: { token, redirect_uri: store.getters.redirectUri }
  })
}
